$(document).ajaxSend(function(e, xhr, opt){
    // 只有当URL不是登录接口时才添加token请求头
    if (opt.url !== "user/login") {
        var token = localStorage.getItem("token");
        xhr.setRequestHeader("token", token);
    }
});

function logout() {
    localStorage.removeItem("token");
    window.location.href = "blog_login.html";
}
